﻿using Mes.Domain.BoundedContext.EntityBase;

namespace Mes.Domain.BoundedContext.Entities.Quality
{
    /// <summary>
    /// 采样计划实体表
    /// </summary>
    public class SamplePlan : NoIdEntityBase
    {
        public SamplePlan() { }

        public SamplePlan(string planName, string? planDesc, string sampleName, string? spare1, string? spare2, string? spare3, string? spare4, DateTime lastEditAt)
        {
            Plan_Name = planName;
            Plan_Desc = planDesc;
            Sample_Name = sampleName;
            Spare1 = spare1;
            Spare2 = spare2;
            Spare3 = spare3;
            Spare4 = spare4;
            Last_Edit_At = lastEditAt;
        }

        /// <summary>
        /// 采样计划名称
        /// </summary>
        public string Plan_Name { get; set; } = string.Empty;

        /// <summary>
        /// 采样计划描述
        /// </summary>
        public string? Plan_Desc { get; set; }

        /// <summary>
        /// 采样计划所属的类别
        /// </summary>
        public int? Category_Id { get; set; } = null;

        /// <summary>
        /// 已验证的写入操作，即操作员是否需要确认手动输入的值
        /// </summary>
        public bool Verified_Write { get; set; } = false;

        /// <summary>
        /// 采样命名惯例
        /// </summary>
        public string Sample_Name { get; set; } = "[SamplePlanName][YYYY][MM][DD][####]";

        /// <summary>
        /// 编号重设选项
        /// If sample name contains at least one octothorpe #, what should cause it to go back to 1
        /// 0=default: nothing, never resets; 1=change in date.  Other choices may be added depending on options within the sample_name field
        /// </summary>
        public int Reset_Option { get; set; } = 0;

        /// <summary>
        /// 采样计划备用字段1
        /// </summary>
        public string? Spare1 { get; set; }

        /// <summary>
        /// 采样计划备用字段2
        /// </summary>
        public string? Spare2 { get; set; }

        /// <summary>
        /// 采样计划备用字段3
        /// </summary>
        public string? Spare3 { get; set; }

        /// <summary>
        /// 采样计划备用字段4
        /// </summary>
        public string? Spare4 { get; set; }

        /// <summary>
        /// 最新更新备注，为何更新
        /// </summary>
        public string? Last_Edit_Comment { get; set; }

        /// <summary>
        /// 最新更新用户
        /// </summary>
        public string Last_Edit_By { get; set; } = string.Empty;

        /// <summary>
        /// 最新更新时间
        /// </summary>
        public DateTime Last_Edit_At { get; set; } = DateTime.Now;

        /// <summary>
        /// 采样计划id, 主键
        /// </summary>
        public int Plan_Id { get; set; } = 0;
    }
}
